#include "thirdwindow.h"
#include "secondwindowNVE.h"
#include "secondwindowNVT.h"
#include"secondwindow.h"
#include<QPushButton>
#include<QDebug>
//#include<QLineEdit>
#include<QLabel>
#include<QPixmap>
#include<QPainter>
#include<QElapsedTimer>
thirdwindow::thirdwindow(QWidget *parent) : QMainWindow(parent)
{
    this->setMinimumSize(800,600);
    this->setWindowIcon(QPixmap(":/new/Camera Roll/XH.jpeg"));
    this->setWindowTitle("分子动力学模拟");
    QLabel * label1 = new QLabel("扩散系数(A^2/fs):");
    label1 ->resize(200,30);
    label1 ->move(100,350);
    label1 ->setParent(this);
    label1 ->hide();
   // QLineEdit * line1 = new QLineEdit;
    line1 = new QLineEdit(this);
    line1 -> resize(200,30);
    line1 -> move(300,350);
    line1 ->setParent(this);
    line1 ->hide();



    QPushButton * KSXS = new QPushButton("计算扩散系数");
    KSXS->resize(200,100);
    KSXS->setParent(this);
    KSXS->move(300,200);

    connect(KSXS,&QPushButton::clicked,[=](){

       QElapsedTimer t;
       t.start();
       while(t.elapsed()<1500);
       label1 ->show();
       line1 ->show();
    });

    QLabel* label2 = new QLabel("结果文件(out.xyz)路径:");
    label2 ->resize(200,40);
    label2 ->move(300,50);
    label2 ->setParent(this);
    line2 = new QLineEdit(this);
    line2 ->resize(700,30);
    line2 -> move(50,100);
    line2 ->setParent(this);

//    QPushButton * backBtn = new QPushButton("返回");
//    backBtn->resize(100,50);
//    backBtn->setParent(this);
//    backBtn->move(550,300);
//    connect(backBtn,&QPushButton::clicked,[=](){
//        qDebug()<<"点击了返回按钮";
//        emit this-> thirdBack();
//    });

    QPushButton * clo = new QPushButton("关闭");
    clo->resize(100,40);
    clo->setParent(this);
    clo->move(690,550);
    connect(clo,&QPushButton::clicked,[=](){
         this-> close();
    });


}
void thirdwindow::getData(QString a_str,QString curPath)
{
   line1 ->setText(a_str);
   line2 ->setText(curPath+"/out.xyz");
}

void thirdwindow::getData1(QString a_str,QString curPath)
{
   line1 ->setText(a_str);
   line2 ->setText(curPath);
}

void thirdwindow::paintEvent(QPaintEvent *)
    {
//        QPainter painter(this);
//        QPixmap pix;
//      //  pix.load(":/Camera Roll/MM.png");
//      //  painter.drawPixmap(0,0,this->width(),this->height(),pix);
//        //背景上的图
//        pix.load(":/Camera Roll/SJ.jpg");
//        painter.drawPixmap(50,200,700,300,pix);
    }

